Welcome Guest | Sign in | Register

Home > C Programming > Defining Variables > Questions and Answers

01. What will be the output of the following statements?

long int a = scanf("%ld%ld",&a,&a); printf("%ld",a);
A. error B. garbage value
C. 0 D. 2

Answer and Explanation

Answer: garbage value

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
02. What will be the output of the following C code?
void main()
{
unsigned giveit=-1;
int gotit;
printf("%u ",++giveit);
printf("%u \n",gotit=--giveit);
}
A. 0 65535 B. 0 65534
C. 0 65532 D. Compilation error

Answer and Explanation

Answer: 0 65535

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
03. What will be the output of the following C code?
main()
{
int x,y=2,z,a;
if(x=y%2) z=2;
a=2;
printf("%d %d ",z,x);
}
A. 2 B. Garbage-value 0
C. 0 D. 1

Answer and Explanation

Answer: Garbage-value 0

Explanation:
The value of y%2 is 0. This value is assigned to x. The condition reduces to if (x) or in other words if(0) and so z goes uninitialized.

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
04. Which of the following is a static string?
A. Static String B. "Static String"
C. 'Static String' D. char string[100];

Answer and Explanation

Answer: "Static String"

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
05. What character ends all strings?
A. '.' B. ' '
C. '\0' D. '\n'

Answer and Explanation

Answer: '\0'

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
06. Which of the following reads in a string named x with one hundred characters?
A. fgets(x, 101, stdin); B. fgets(x, 100, stdin);
C. readline(x, 100, '\n'); D. read(x);

Answer and Explanation

Answer: fgets(x, 101, stdin);

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
07. Which of the following functions compares two strings?
A. compare(); B. stringcompare();
C. cmp(); D. strcmp();

Answer and Explanation

Answer: strcmp();

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
08. Which of the following adds one string to the end of another?
A. append(); B. stringadd();
C. strcat(); D. stradd();

Answer and Explanation

Answer: strcat();

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
09. The statement that correctly defines an integer called sum is
A. sum : integer; B. integer sum;
C. int sum; () D. sum int;

Answer and Explanation

Answer: int sum; ()

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
10. The statement that correctly defines a character called letter is
A. letter := char; B. char letter;
C. letter : char; D. character letter;

Answer and Explanation

Answer: char letter;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum



Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.